package indi.entity;

import java.util.ArrayList;
import java.util.List;

import indi.service.CardService;

//借书证
public class Card {
	//数据库自动生成ID
	private int id;
	//当前借阅证状态
	private int currentStatues;
	//当前借书记录
	// 改成编号就可以了，因为从数据库回呼不出来
	private ArrayList<Record> currentRecords;
	//当前关联学生ID
	private Student currentStudent;
	
	
	
	//构造函数
	// 注意：不是public属性，不能被其他类构造，这能是CardService构造
		public Card(Student student) {
			super();
			//！先从一开始分配
			this.id = CardService.getCOUNTOFREGISTE() + 1;
			this.currentStudent = student;
			this.currentRecords = new ArrayList<>();
			student.setCard(this);
			this.currentStatues = CardService.NONE;
		}

	public String toString() {
		return id + "|" + currentStatues 
				  + "|" + currentRecords.toString()
				  + "|" + currentStudent.toString();
	}
		/**
		 * @return the currentStatues
		 */
		public int getCurrentStatues() {
			return currentStatues;
		}

		/**
		 * @param currentStatues the currentStatues to set
		 */
		public void setCurrentStatues(int currentStatues) {
			this.currentStatues = currentStatues;
		}

		/**
		 * @return the id
		 */
		public int getId() {
			return id;
		}

		/**
		 * @return the currentRecords
		 */
		public ArrayList<Record> getCurrentRecords() {
			return currentRecords;
		}

		
	
}
